DateTimeEditors for WinRT > C1TimeEditor Help > C1TimeEditor Task-Based Help > Specifying the Current Time |
You can specify the current time of a C1TimeEditor control by setting the C1TimeEditor.Value property in code.
Try to avoid setting the C1TimeEditor.Value property in XAML as a string value. Parsing these values from strings is culture specific. If you set a value with your current culture and a user is using different culture, the user can get XamlParseException when loading your site. The best practice is to set these values from code or via data binding. |
In the Designer
Complete the following steps:
In XAML
To specify the current time, place Value="07:00:00" to the <DateTimeEditors:C1TimeEditor>tag so that the markup resembles the following:
Markup |
Copy Code
|
---|---|
<DateTimeEditors:C1TimeEditor Value="07:00:00"/>
|
The control reflects a time of 7:00:00 a.m.
In Code
Complete the following steps:
Visual Basic Copy Code C1TimeEditor1.Value = New TimeSpan(7, 0, 0)
C# Copy Codec1TimeEditor1.Value = new TimeSpan(7,0,0);
This Topic Illustrates the Following:
By following the steps in this topic, you have changed the time on the C1TimeEditor control to 7:00:00 a.m. The result will resemble the following: